package com.by.controller;

import com.by.remote.StockRemoteClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @version 1.0
 * @Author 彭彦彬
 * @Date 2025/4/2 14:32
 * @注释
 */
@RestController
public class GoodsController {
    @Autowired
    private StockRemoteClient stockRemoteClient;

    @GetMapping("/goods")
    public Map query(int id) {
        Map map = new HashMap();
        map.put("id", id);
        map.put("name", "小米手机");
        //查询商品库存
        Map mapStock = stockRemoteClient.query(id);
        map.put("stock", mapStock);
        return map;
    }
}
